<?php
class Zend_View_Helper_DrawMenuAdmin extends Zend_View_Helper_Abstract
{
	protected $ft;
	public function __construct()
	{
	$this->ft = true;
	}
	public function Draw($Array,$Prefix = '')
	{
		if (  count($Array)  ) 
		{
			echo "<ul class='sf-menu'>";
			foreach ($Array as $Value)
			{
			    echo "<li tid='{$Value['ID']}'><a href='{$Value['Link']}'>" . str_replace(' ','&nbsp;', $Value['Name']) . "</a>";	
                if( isset($Value['sub']) && count($Value['sub']) ) 
                {
                    $ArraySub = $Value['sub'];
                    echo '<ul>'; 
                	foreach($ArraySub as $Value2)
                	{
                        echo "<li tid='{$Value2['ID']}'><a href='{$Value2['Link']}'>" . str_replace(' ','&nbsp;', $Value2['Name']) . "</a>";
                        if( isset($Value2['sub']) && count($Value2['sub']) )
                        {
                            $ArraySub2 = $Value2['sub'];
                            echo '<ul>'; 
                	        foreach($ArraySub2 as $Value3)
                	        {
                                echo "<li tid='{$Value3['ID']}'><a href='{$Value3['Link']}'>" . str_replace(' ','&nbsp;', $Value3['Name']) . "</a></li>";
                	        }
                	        echo '</ul>';
                        }
                        echo "</li>";
                	}                	
                	echo '</ul>';
                }
                echo "</li>"; 
			}
			echo "</ul>";
		}
	}
	
	
	public function drawMenuAdmin()
	{
        $Menu = new Menu();
        $Array= $Menu->buildHierarchy();
        
	    $this->Draw($Array);
	}
}